\(\int \sqrt {1-\cot ^2(x)} \, dx\) [39]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [C] (verification not implemented)
   Giac [C] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 12, antiderivative size = 32 \[ \int \sqrt {1-\cot ^2(x)} \, dx=\arcsin (\cot (x))-\sqrt {2} \arctan \left (\frac {\sqrt {2} \cot (x)}{\sqrt {1-\cot ^2(x)}}\right ) \]

[Out]

arcsin(cot(x))-arctan(cot(x)*2^(1/2)/(1-cot(x)^2)^(1/2))*2^(1/2)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.417, Rules used = {3742, 399, 222, 385, 209} \[ \int \sqrt {1-\cot ^2(x)} \, dx=\arcsin (\cot (x))-\sqrt {2} \arctan \left (\frac {\sqrt {2} \cot (x)}{\sqrt {1-\cot ^2(x)}}\right ) \]

[In]

Int[Sqrt[1 - Cot[x]^2],x]

[Out]

ArcSin[Cot[x]] - Sqrt[2]*ArcTan[(Sqrt[2]*Cot[x])/Sqrt[1 - Cot[x]^2]]

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 222

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Simp[ArcSin[Rt[-b, 2]*(x/Sqrt[a])]/Rt[-b, 2], x] /; FreeQ[{a, b}
, x] && GtQ[a, 0] && NegQ[b]

Rule 385

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Subst[Int[1/(c - (b*c - a*d)*x^n), x]
, x, x/(a + b*x^n)^(1/n)] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && EqQ[n*p + 1, 0] && IntegerQ[n]

Rule 399

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Dist[b/d, Int[(a + b*x^n)^(p - 1), x]
, x] - Dist[(b*c - a*d)/d, Int[(a + b*x^n)^(p - 1)/(c + d*x^n), x], x] /; FreeQ[{a, b, c, d, p}, x] && NeQ[b*c
 - a*d, 0] && EqQ[n*(p - 1) + 1, 0] && IntegerQ[n]

Rule 3742

Int[((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x]
, x]}, Dist[c*(ff/f), Subst[Int[(a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ
[{a, b, c, e, f, n, p}, x] && (IntegersQ[n, p] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {\sqrt {1-x^2}}{1+x^2} \, dx,x,\cot (x)\right ) \\ & = -\left (2 \text {Subst}\left (\int \frac {1}{\sqrt {1-x^2} \left (1+x^2\right )} \, dx,x,\cot (x)\right )\right )+\text {Subst}\left (\int \frac {1}{\sqrt {1-x^2}} \, dx,x,\cot (x)\right ) \\ & = \arcsin (\cot (x))-2 \text {Subst}\left (\int \frac {1}{1+2 x^2} \, dx,x,\frac {\cot (x)}{\sqrt {1-\cot ^2(x)}}\right ) \\ & = \arcsin (\cot (x))-\sqrt {2} \arctan \left (\frac {\sqrt {2} \cot (x)}{\sqrt {1-\cot ^2(x)}}\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.10 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.94 \[ \int \sqrt {1-\cot ^2(x)} \, dx=\frac {\sqrt {1-\cot ^2(x)} \left (-\text {arctanh}\left (\frac {\cos (x)}{\sqrt {\cos (2 x)}}\right )+\sqrt {2} \log \left (\sqrt {2} \cos (x)+\sqrt {\cos (2 x)}\right )\right ) \sin (x)}{\sqrt {\cos (2 x)}} \]

[In]

Integrate[Sqrt[1 - Cot[x]^2],x]

[Out]

(Sqrt[1 - Cot[x]^2]*(-ArcTanh[Cos[x]/Sqrt[Cos[2*x]]] + Sqrt[2]*Log[Sqrt[2]*Cos[x] + Sqrt[Cos[2*x]]])*Sin[x])/S
qrt[Cos[2*x]]

Maple [A] (verified)

Time = 0.08 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.06

method result size
derivativedivides \(\arcsin \left (\cot \left (x \right )\right )+\sqrt {2}\, \arctan \left (\frac {\sqrt {2}\, \sqrt {1-\cot \left (x \right )^{2}}\, \cot \left (x \right )}{-1+\cot \left (x \right )^{2}}\right )\) \(34\)
default \(\arcsin \left (\cot \left (x \right )\right )+\sqrt {2}\, \arctan \left (\frac {\sqrt {2}\, \sqrt {1-\cot \left (x \right )^{2}}\, \cot \left (x \right )}{-1+\cot \left (x \right )^{2}}\right )\) \(34\)

[In]

int((1-cot(x)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

arcsin(cot(x))+2^(1/2)*arctan(2^(1/2)*(1-cot(x)^2)^(1/2)/(-1+cot(x)^2)*cot(x))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 68 vs. \(2 (26) = 52\).

Time = 0.28 (sec) , antiderivative size = 68, normalized size of antiderivative = 2.12 \[ \int \sqrt {1-\cot ^2(x)} \, dx=\sqrt {2} \arctan \left (\frac {\sqrt {\frac {\cos \left (2 \, x\right )}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right )}{\cos \left (2 \, x\right ) + 1}\right ) - \arctan \left (\frac {\sqrt {2} \sqrt {\frac {\cos \left (2 \, x\right )}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right )}{\cos \left (2 \, x\right ) + 1}\right ) \]

[In]

integrate((1-cot(x)^2)^(1/2),x, algorithm="fricas")

[Out]

sqrt(2)*arctan(sqrt(cos(2*x)/(cos(2*x) - 1))*sin(2*x)/(cos(2*x) + 1)) - arctan(sqrt(2)*sqrt(cos(2*x)/(cos(2*x)
 - 1))*sin(2*x)/(cos(2*x) + 1))

Sympy [F]

\[ \int \sqrt {1-\cot ^2(x)} \, dx=\int \sqrt {1 - \cot ^{2}{\left (x \right )}}\, dx \]

[In]

integrate((1-cot(x)**2)**(1/2),x)

[Out]

Integral(sqrt(1 - cot(x)**2), x)

Maxima [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.85 (sec) , antiderivative size = 507, normalized size of antiderivative = 15.84 \[ \int \sqrt {1-\cot ^2(x)} \, dx=-\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} \arctan \left (\frac {{\left ({\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}^{4} + 16 \, \cos \left (2 \, x\right )^{4} + 16 \, \sin \left (2 \, x\right )^{4} + 8 \, {\left (\cos \left (2 \, x\right )^{2} - \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )} {\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}^{2} + 64 \, \cos \left (2 \, x\right )^{3} + 32 \, {\left (\cos \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )} \sin \left (2 \, x\right )^{2} + 96 \, \cos \left (2 \, x\right )^{2} + 64 \, \cos \left (2 \, x\right ) + 16\right )}^{\frac {1}{4}} \sin \left (\frac {1}{2} \, \arctan \left (\frac {8 \, {\left (\cos \left (2 \, x\right ) + 1\right )} \sin \left (2 \, x\right )}{{\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}^{2}}, \frac {{\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}^{2} + 4 \, \cos \left (2 \, x\right )^{2} - 4 \, \sin \left (2 \, x\right )^{2} + 8 \, \cos \left (2 \, x\right ) + 4}{{\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}^{2}}\right )\right ) + 2 \, \sin \left (2 \, x\right )}{{\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}}, \frac {{\left ({\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}^{4} + 16 \, \cos \left (2 \, x\right )^{4} + 16 \, \sin \left (2 \, x\right )^{4} + 8 \, {\left (\cos \left (2 \, x\right )^{2} - \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )} {\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}^{2} + 64 \, \cos \left (2 \, x\right )^{3} + 32 \, {\left (\cos \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )} \sin \left (2 \, x\right )^{2} + 96 \, \cos \left (2 \, x\right )^{2} + 64 \, \cos \left (2 \, x\right ) + 16\right )}^{\frac {1}{4}} \cos \left (\frac {1}{2} \, \arctan \left (\frac {8 \, {\left (\cos \left (2 \, x\right ) + 1\right )} \sin \left (2 \, x\right )}{{\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}^{2}}, \frac {{\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}^{2} + 4 \, \cos \left (2 \, x\right )^{2} - 4 \, \sin \left (2 \, x\right )^{2} + 8 \, \cos \left (2 \, x\right ) + 4}{{\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}^{2}}\right )\right ) + 2 \, \cos \left (2 \, x\right ) + 2}{{\left | 2 \, e^{\left (2 i \, x\right )} - 2 \right |}}\right ) - \arctan \left ({\left (\cos \left (4 \, x\right )^{2} + \sin \left (4 \, x\right )^{2} + 2 \, \cos \left (4 \, x\right ) + 1\right )}^{\frac {1}{4}} \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (4 \, x\right ), \cos \left (4 \, x\right ) + 1\right )\right ) + \sin \left (2 \, x\right ), {\left (\cos \left (4 \, x\right )^{2} + \sin \left (4 \, x\right )^{2} + 2 \, \cos \left (4 \, x\right ) + 1\right )}^{\frac {1}{4}} \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (4 \, x\right ), \cos \left (4 \, x\right ) + 1\right )\right ) + \cos \left (2 \, x\right )\right )\right )} \]

[In]

integrate((1-cot(x)^2)^(1/2),x, algorithm="maxima")

[Out]

-1/2*sqrt(2)*(sqrt(2)*arctan2(((abs(2*e^(2*I*x) - 2)^4 + 16*cos(2*x)^4 + 16*sin(2*x)^4 + 8*(cos(2*x)^2 - sin(2
*x)^2 + 2*cos(2*x) + 1)*abs(2*e^(2*I*x) - 2)^2 + 64*cos(2*x)^3 + 32*(cos(2*x)^2 + 2*cos(2*x) + 1)*sin(2*x)^2 +
 96*cos(2*x)^2 + 64*cos(2*x) + 16)^(1/4)*sin(1/2*arctan2(8*(cos(2*x) + 1)*sin(2*x)/abs(2*e^(2*I*x) - 2)^2, (ab
s(2*e^(2*I*x) - 2)^2 + 4*cos(2*x)^2 - 4*sin(2*x)^2 + 8*cos(2*x) + 4)/abs(2*e^(2*I*x) - 2)^2)) + 2*sin(2*x))/ab
s(2*e^(2*I*x) - 2), ((abs(2*e^(2*I*x) - 2)^4 + 16*cos(2*x)^4 + 16*sin(2*x)^4 + 8*(cos(2*x)^2 - sin(2*x)^2 + 2*
cos(2*x) + 1)*abs(2*e^(2*I*x) - 2)^2 + 64*cos(2*x)^3 + 32*(cos(2*x)^2 + 2*cos(2*x) + 1)*sin(2*x)^2 + 96*cos(2*
x)^2 + 64*cos(2*x) + 16)^(1/4)*cos(1/2*arctan2(8*(cos(2*x) + 1)*sin(2*x)/abs(2*e^(2*I*x) - 2)^2, (abs(2*e^(2*I
*x) - 2)^2 + 4*cos(2*x)^2 - 4*sin(2*x)^2 + 8*cos(2*x) + 4)/abs(2*e^(2*I*x) - 2)^2)) + 2*cos(2*x) + 2)/abs(2*e^
(2*I*x) - 2)) - arctan2((cos(4*x)^2 + sin(4*x)^2 + 2*cos(4*x) + 1)^(1/4)*sin(1/2*arctan2(sin(4*x), cos(4*x) +
1)) + sin(2*x), (cos(4*x)^2 + sin(4*x)^2 + 2*cos(4*x) + 1)^(1/4)*cos(1/2*arctan2(sin(4*x), cos(4*x) + 1)) + co
s(2*x)))

Giac [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.29 (sec) , antiderivative size = 170, normalized size of antiderivative = 5.31 \[ \int \sqrt {1-\cot ^2(x)} \, dx=-\frac {1}{2} \, {\left (\pi - \sqrt {2} \pi - 2 \, \sqrt {2} \arctan \left (-\frac {1}{2} i \, \sqrt {2}\right ) + 2 \, \arctan \left (-i\right )\right )} \mathrm {sgn}\left (\sin \left (x\right )\right ) + \frac {1}{2} \, {\left (\pi \mathrm {sgn}\left (\cos \left (x\right )\right ) - \sqrt {2} {\left (\pi \mathrm {sgn}\left (\cos \left (x\right )\right ) + 2 \, \arctan \left (-\frac {{\left (\frac {{\left (\sqrt {2} \sqrt {-2 \, \cos \left (x\right )^{2} + 1} - \sqrt {2}\right )}^{2}}{\cos \left (x\right )^{2}} - 4\right )} \cos \left (x\right )}{4 \, {\left (\sqrt {2} \sqrt {-2 \, \cos \left (x\right )^{2} + 1} - \sqrt {2}\right )}}\right )\right )} + 2 \, \arctan \left (-\frac {\sqrt {2} {\left (\frac {{\left (\sqrt {2} \sqrt {-2 \, \cos \left (x\right )^{2} + 1} - \sqrt {2}\right )}^{2}}{\cos \left (x\right )^{2}} - 4\right )} \cos \left (x\right )}{4 \, {\left (\sqrt {2} \sqrt {-2 \, \cos \left (x\right )^{2} + 1} - \sqrt {2}\right )}}\right )\right )} \mathrm {sgn}\left (\sin \left (x\right )\right ) \]

[In]

integrate((1-cot(x)^2)^(1/2),x, algorithm="giac")

[Out]

-1/2*(pi - sqrt(2)*pi - 2*sqrt(2)*arctan(-1/2*I*sqrt(2)) + 2*arctan(-I))*sgn(sin(x)) + 1/2*(pi*sgn(cos(x)) - s
qrt(2)*(pi*sgn(cos(x)) + 2*arctan(-1/4*((sqrt(2)*sqrt(-2*cos(x)^2 + 1) - sqrt(2))^2/cos(x)^2 - 4)*cos(x)/(sqrt
(2)*sqrt(-2*cos(x)^2 + 1) - sqrt(2)))) + 2*arctan(-1/4*sqrt(2)*((sqrt(2)*sqrt(-2*cos(x)^2 + 1) - sqrt(2))^2/co
s(x)^2 - 4)*cos(x)/(sqrt(2)*sqrt(-2*cos(x)^2 + 1) - sqrt(2))))*sgn(sin(x))

Mupad [B] (verification not implemented)

Time = 14.19 (sec) , antiderivative size = 88, normalized size of antiderivative = 2.75 \[ \int \sqrt {1-\cot ^2(x)} \, dx=\mathrm {asin}\left (\mathrm {cot}\left (x\right )\right )-\frac {\sqrt {2}\,\ln \left (\frac {\frac {\sqrt {2}\,\left (-1+\mathrm {cot}\left (x\right )\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2}-\sqrt {1-{\mathrm {cot}\left (x\right )}^2}\,1{}\mathrm {i}}{\mathrm {cot}\left (x\right )-\mathrm {i}}\right )\,1{}\mathrm {i}}{2}+\frac {\sqrt {2}\,\ln \left (\frac {\frac {\sqrt {2}\,\left (1+\mathrm {cot}\left (x\right )\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2}+\sqrt {1-{\mathrm {cot}\left (x\right )}^2}\,1{}\mathrm {i}}{\mathrm {cot}\left (x\right )+1{}\mathrm {i}}\right )\,1{}\mathrm {i}}{2} \]

[In]

int((1 - cot(x)^2)^(1/2),x)

[Out]

asin(cot(x)) - (2^(1/2)*log(((2^(1/2)*(cot(x)*1i - 1)*1i)/2 - (1 - cot(x)^2)^(1/2)*1i)/(cot(x) - 1i))*1i)/2 +
(2^(1/2)*log(((2^(1/2)*(cot(x)*1i + 1)*1i)/2 + (1 - cot(x)^2)^(1/2)*1i)/(cot(x) + 1i))*1i)/2